import { Navigate, Outlet } from 'umi';
import { getCookie } from '@/utils/cookieUtils';

export default () => {
  // 检查cookie中是否有token来判断用户是否已登录
  const token = getCookie('token');
  const isLogin = !!token;
  
  if (isLogin) {
    return <Outlet />;
  } else {
    return <Navigate to="/login" />;
  }
};
